<?php

namespace app\system\controller;

use app\system\model\UserModel;

use app\system\service\UserRoleService;
use app\system\service\UserService;
use think\facade\Db;
use think\Request;

class User
{
    protected $userService;
    protected $userRoleService;

    public function __construct(UserService $userService, UserRoleService $userRoleService)
    {
        $this->userService = $userService;
        $this->userRoleService = $userRoleService;
    }

    public function getUserList(Request $request)
    {
        $users = $this->userService->userList($request);

        // 发送JSON响应
        return returnPageJson( $users);
    }

    public function deleteUser(Request $request)
    {
        return $this->userService->deleteUser($request);
    }
    public function updateUser(Request $request)
    {
        return $this->userService->updateUser($request);
    }
    public function saveUser(Request $request)
    {
        return $this->userService->saveUser($request);
    }
    public function updateStatus(Request $request)
    {
        return $this->userService->updateStatus($request);
    }
    public function saveUserRole(Request $request)
    {
        return $this->userRoleService->saveUserRole($request);
    }
    public function resetPassword(Request $request){
        return $this->userService->resetPassword($request);
    }
}